home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 May / MacHome CD (May 2001).iso / mac / Stuff / Software / Tools / Black & Bleu™ 3.0 / For Developers / Usage Example / BleuRoseErrors.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-26  |  12.7 KB  |  359 lines  |  [TEXT/CWIE]

  1. /*    
  2. BleuRoseErrors.h - This file defines the various data structures and
  3.                         function calls available in the Bleu Rose Ltd.
  4.                         Error Library
  5.  
  6.     Copyright 2000 Bleu Rose Ltd. All Rights Reserved.
  7.  
  8.     Author:        Gary Rice
  9.  
  10.     Created:    August 26, 2000 - Original development environment:
  11.                     CodeWarrior/Pro v5.3
  12.                     Mac OS v7.6.1
  13.  
  14.     Modified:    N/A
  15.  
  16.     Licensing Notes:
  17.         You may incorporate this source code into your
  18.         applications without restriction.
  19.  
  20.         You are NOT permitted to redistribute the source,
  21.         compiled binaries or the library that the code
  22.         references without first licensing the package
  23.         represented by this source file from Bleu Rose Ltd.
  24.  
  25.         Licensing information was packaged with the files
  26.         that this file was part of. If that licensing information
  27.         is no longer included in the files you have, you may obtain
  28.         another copy by sending EMail to licensing@bleurose.com
  29.         and asking for the Error Library Licensing Package.
  30.  
  31.     Usage Notes:
  32.         This file is compatible with Universal Headers v3.2 and later.
  33.  
  34.  ******************************************************************
  35.     PROLOGUE
  36.  ******************************************************************/
  37. #ifndef __BleuRoseErrors__
  38. #define __BleuRoseErrors__
  39.  
  40. #include <CodeFragments.h>
  41. #include <MixedMode.h>
  42. #include <ConditionalMacros.h>
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. /******************************************************************
  60.     TYPES & CONSTANTS
  61.  ******************************************************************/
  62. #define kBleuRoseErrorLibVersion        0x0300                    /* This is version 3 of the library */
  63. #define kBleuRoseErrorLibResType        'FAT '                    /* Resource has both 68k & PPC code */
  64. #define kBleuRoseErrorLibCommonResID    29271                    /* This value should not be changed */
  65. #define kBleuRoseErrorLibListType        'STR#'                    /* The error type list is this res kind */
  66. #define kBleuRoseErrorLibNoDescType        'STR '                    /* The no description message is this res kind */
  67. #define kBleuRoseErrorLibDataType        'TEXT'                    /* The library is a TEXT resources */
  68. #define kEstimatedErrorResSize            256000                    /* The TEXT resource is at least this big */
  69. #define kBleuRoseErrorLibFileName        "\pBleuRoseErrorLib"    /* The name of the file */
  70.  
  71. typedef struct
  72. {
  73.     SInt32    action;                        /* What information do you want? */
  74.     SInt32    error;                        /* The error number to look up */
  75.     SInt16    proposedErrorTypeNumber;    /* The Error Type value to try */
  76.     SInt16    actualErrorTypeNumber;        /* The Error Type value matching the error found */
  77.     Str255    errorTypeName;                /* Name string of the Error Type number */
  78.     Str255    pneumonic;                    /* Apple's name for this error */
  79.     Str255    description;                /* Apple's explanation of this error */
  80. } BleuRoseErrorLibStructure, *BleuRoseErrorLibStructurePtr;
  81.  
  82. typedef long (*BleuRoseErrorLib)(BleuRoseErrorLibStructurePtr inOutData);
  83.  
  84. enum
  85. {
  86.     uppBleuRoseErrorLibProcInfo = kCStackBased
  87.         | RESULT_SIZE (SIZE_CODE (sizeof(OSStatus)))
  88.         | STACK_ROUTINE_PARAMETER (1, SIZE_CODE(sizeof(BleuRoseErrorLib*)))
  89.         | STACK_ROUTINE_PARAMETER (2, SIZE_CODE(sizeof(BleuRoseErrorLibStructurePtr)))
  90. };
  91.  
  92. enum        /* Error types from STR# resource 29271 (listed alphabetically) */
  93. {
  94.     k1stErrorTypeFound                        = 0,
  95.     kAnsiCType                                = 175,
  96.     kAppearanceManagerType                    = 1,
  97.     kAppleCryptographicMessageSyntaxType    = 137,
  98.     kAppleDataStreamingProtocolType            = 2,
  99.     kAppleDVDPlayerType                        = 167,
  100.     kAppleEventManagerType                    = 3,
  101.     kAppleEventRegistryType                    = 4,
  102.     kAppleFileSigningType                    = 136,
  103.     kAppleGuideType                            = 6,
  104.     kAppleOpenCollaborativeEnvironmentType    = 142,
  105.     kAppleScriptType                        = 7,
  106.     kAppleSearchType                        = 101,
  107.     kAppleSearchForWindowsType                = 116,
  108.     kAppleServerProtocolType                = 8,
  109.     kAppleScriptClientType                    = 9,
  110.     kAppleShareClientType                    = 10,
  111.     kAppleShareFileServerType                = 145,
  112.     kAppleShareRegistryType                    = 11,
  113.     kAppleShareServerType                    = 126,
  114.     kAppleSystemProfilerType                = 113,
  115.     kAppleTalkFilingProtocolType            = 5,
  116.     kAppleTalkManagerType                    = 102,
  117.     kAppleTalkRemoteAccessType                = 12,
  118.     kAppleTalkRemoteAccessScriptingType        = 141,
  119.     kAppleTypeServicesType                    = 128,
  120.     kAppleVisionType                        = 176,
  121.     kAR2Type                                = 139,
  122.     kAroseType                                = 143,
  123.     kAvlTreeType                            = 181,
  124.     kBleuRoseErrorLibType                    = 168,
  125.     kCameraType                                = 14,
  126.     kCarbonEventManagerType                    = 169,
  127.     kCardAndSocketServicesType                = 15,
  128.     kClockType                                = 110,
  129.     kCodeFragmentManagerType                = 16,
  130.     kCollectionManagerType                    = 18,
  131.     kColorManagerType                        = 109,
  132.     kColorPickerType                        = 19,
  133.     kColorQuickdrawType                        = 120,
  134.     kColorSyncManagerType                    = 20,
  135.     kColorSyncScriptingType                    = 21,
  136.     kCommunicationsToolboxType                = 155,
  137.     kComponentManagerType                    = 22,
  138.     kCompressorDecompressorType                = 17,
  139.     kConnectionManagerType                    = 156,
  140.     kControlManagerType                        = 23,
  141.     kCoreFoundationType                        = 146,
  142.     kDatabaseAccessType                        = 24,
  143.     kDebuggingLibraryType                    = 151,
  144.     kDeviceManagerType                        = 114,
  145.     kDialogManagerType                        = 149,
  146.     kDictionaryManagerType                    = 25,
  147.     kDirectoryServicesType                    = 106,
  148.     kDiskType                                = 111,
  149.     kDisplayManagerType                        = 26,
  150.     kDownloadManagerType                    = 131,
  151.     kDragManagerType                        = 27,
  152.     kDrawSprocketType                        = 28,
  153.     kEditionManagerType                        = 29,
  154.     kFileManagerType                        = 105,
  155.     kFileTransferManagerType                = 157,
  156.     kFindByContentType                        = 30,
  157.     kFinderType                                = 159,
  158.     kFireWireType                            = 31,
  159.     kFolderManagerType                        = 32,
  160.     kFontManagerType                        = 117,
  161.     kFontSyncType                            = 154,
  162.     kGeneralSystemType                        = 33,
  163.     kGeneralTextType                        = 34,
  164.     kGeoPortType                            = 35,
  165.     kGestaltType                            = 36,
  166.     kHelpManagerType                        = 37,
  167.     kHfsType                                = 119,
  168.     kHfsExternalFileSystemType                = 38,
  169.     kHtmlRenderingType                        = 147,
  170.     kHumanInterfaceDeviceType                = 152,
  171.     kHyperCardXcmdType                        = 179,
  172.     kIconUtiltiesType                        = 39,
  173.     kImovieType                                = 171,
  174.     kInputSprocketType                        = 40,
  175.     kInternationalDateAndTimeType            = 124,
  176.     kInternetConfigType                        = 160,
  177.     kIoSystemType                            = 41,
  178.     kIrDaType                                = 130,
  179.     kJavaVirtualMachineManagerType            = 42,
  180.     kKeyChainManagerType                    = 43,
  181.     kKernelType                                = 44,
  182.     kLanguageAnalysisManagerType            = 45,
  183.     kLaserWriter8Type                        = 46,
  184.     kLibraryManagerType                        = 47,
  185.     kLinkToolManagerType                    = 134,
  186.     kLocaleObjectManagerType                = 48,
  187.     kMacintoshManagerType                    = 172,
  188.     kMacTextEditorType                        = 153,
  189.     kMacTcpType                                = 49,
  190.     kMemoryDispatchType                        = 50,
  191.     kMemoryManagerType                        = 51,
  192.     kMenuManagerType                        = 118,
  193.     kMidiManagerType                        = 53,
  194.     kMixedModeType                            = 54,
  195.     kModemCclType                            = 140,
  196.     kMultiprocessorType                        = 55,
  197.     kNameBindingProtocolType                = 56,
  198.     kNameRegistryType                        = 57,
  199.     kNavigationServicesType                    = 58,
  200.     kNetBootType                            = 177,
  201.     kNetSprocketType                        = 59,
  202.     kNetShareManagerType                    = 138,
  203.     kNetworkServicesLocationType            = 125,
  204.     kNetworkSetupType                        = 65,
  205.     kNotificationManagerType                = 60,
  206.     kOffScreenQuickDrawType                    = 62,
  207.     kOpenGlType                                = 123,
  208.     kOpenScriptingArchitectureType            = 63,
  209.     kOpenTransportType                        = 64,
  210.     kOpenDocType                            = 135,
  211.     kOperatingSystemType                    = 164,
  212.     kPackageManagerType                        = 133,
  213.     kPaletteManagerType                        = 180,
  214.     kPcAtAttachmentType                        = 13,
  215.     kPcCardType                                = 66,
  216.     kPlugInsManagerType                        = 132,
  217.     kPowerMacDebuggerType                    = 174,
  218.     kPowerManagerType                        = 68,
  219.     kPrinterStatusType                        = 69,
  220.     kPrintingType                            = 70,
  221.     kPrintingManagerType                    = 178,
  222.     kProcessManagerType                        = 71,
  223.     kProcessToProcessCommunicationType        = 67,
  224.     kQuickdrawType                            = 162,
  225.     kQuickdraw3dType                        = 72,
  226.     kQuickdrawGxType                        = 73,
  227.     kQuickdrawGxMessageManagerType            = 52,
  228.     kQuickdrawGxPrintingType                = 74,
  229.     kQuickTimeType                            = 75,
  230.     kQuickTimeConferencingType                = 76,
  231.     kQuickTimeIcType                        = 77,
  232.     kQuickTimeMusicType                        = 183,
  233.     kQuickTimeStreamingType                    = 144,
  234.     kQuickTimeVRType                        = 78,
  235.     kQuickTimeForWindowsType                = 79,
  236.     kRendererAccelerationVirtualEngineType    = 165,
  237.     kResourceManagerType                    = 80,
  238.     kScannerType                            = 81,
  239.     kScrapManagerType                        = 82,
  240.     kScsiManagerType                        = 83,
  241.     kSerialDriverType                        = 108,
  242.     kSerialPortType                            = 112,
  243.     kSettingsOrLocationManagerType            = 84,
  244.     kSequenceGrabberType                    = 85,
  245.     kSimpleMulticastRoutingProtocolType        = 103,
  246.     kSlotManagerType                        = 107,
  247.     kSoundManagerType                        = 86,
  248.     kSoundSprocketType                        = 87,
  249.     kSpeechManagerType                        = 88,
  250.     kSpeechRecognitionType                    = 89,
  251.     kStartManagerType                        = 61,
  252.     kStringCompareType                        = 90,
  253.     kSysEnvironsType                        = 115,
  254.     kSysErrsType                            = 161,
  255.     kSystemLoggingServiceType                = 106,
  256.     kSystemNotificationServiceType            = 104,
  257.     kTelephoneManagerType                    = 91,
  258.     kTerminalManagerType                    = 158,
  259.     kTextEditType                            = 163,
  260.     kTextEncodingConversionType                = 92,
  261.     kTextEnginesType                        = 93,
  262.     kTextObjectsType                        = 94,
  263.     kTextServicesManagerType                = 95,
  264.     kThreadManagerType                        = 96,
  265.     kTranslationManagerType                    = 97,
  266.     kUnclassifiedType                        = 100,
  267.     kUnicodeUtilitiesType                    = 98,
  268.     kUniversalSerialBusType                    = 99,
  269.     kUrlAccessType                            = 127,
  270.     kUsersAndGroupsType                        = 121,
  271.     kUtcUtilitiesType                        = 150,
  272.     kVideoDriverType                        = 184,
  273.     kVirtualMemoryManagerType                = 122,
  274.     kVirtualUserType                        = 173,
  275.     kWasteType                                = 182,
  276.     kWindowManagerType                        = 148,
  277.     kXmlParserType                            = 170,
  278.     kXtndType                                = 129,
  279.     kZlastType                                = 185    /* This is not a valid type. It is simply
  280.                                                     set to the highest number in the list + 1. */
  281. };
  282.  
  283. enum
  284. {    /* Warnings (positive values) - A warning should be treated as a conditionally successful status. */
  285.     kWarningErrorNotDescribed        = (long)2147483646L,    /* 0x7FFFFFFE - The error has no description. */
  286.     kWarningErrorNotDescribedAndNotRequestedType
  287.                                     = (long)2147483645L,    /* 0x7FFFFFFD - The error is not the type you requested
  288.                                                                             and the error has no description. */
  289.     kWarningLibraryNotLicensed        = (long)2147483644L,    /* 0x7FFFFFFC - This is an unlicensed library. The error
  290.                                                                              description will be incorrect. */
  291.     kWarningErrorNotRequestedType    = (long)2147483643L,    /* 0x7FFFFFFB - The error is not the type you requested. */
  292.     
  293.     /* Errors (negative values) - An error should be treated as a failure status. */
  294.     kErrorNotOnFile                    = (long)-2147483648L,    /* 0x80000000 - The error you requested is not in the database. */
  295.     /* The following error values duplicate values already on file in the
  296.     database. They were chosen anyway because they are the smallest possible values available. */
  297.     kErrorTypeOutOfRange            = (long)-2147483647L,    /* 0x80000001 - The error type you requested is not valid. */
  298.     kErrorTypeNotOnFile                = (long)-2147483646L,    /* 0x80000002 - The error type you requested is not in the database. */
  299.     kErrorTypeResMissing            = (long)-2147483645L,     /* 0x80000003 - The error type STR# resource is missing. */
  300.     kErrorResMissing                = (long)-2147483644L,     /* 0x80000004 - The error TEXT resource is missing. */
  301.     kErrorNoDescResMissing            = (long)-2147483643L     /* 0x80000005 - The "no description" resource is missing. */
  302. };    /* Note that these error codes are themselves on file in the error database */
  303.  
  304. enum    /* Type of data to return from the database */
  305. {
  306.     kGetError    = -1L,    /* Get the error information */
  307.     kGetType    = -2L    /* Translate the error type to its name equivalent */
  308. };
  309.  
  310. /******************************************************************
  311.     FUNCTION PROTOTYPES
  312.  ******************************************************************/
  313. EXTERN_API_C (OSStatus)
  314. FindBleuRoseErrorLibrary        (FSSpecPtr                         theLibrary);
  315.  
  316. EXTERN_API_C (OSStatus)
  317. CallBleuRoseErrorLibrary        (FSSpecPtr                         theLibrary,
  318.                                  BleuRoseErrorLibStructurePtr    errorInfo);
  319.  
  320. #if TARGET_RT_MAC_CFM
  321.     typedef UniversalProcPtr    BleuRoseErrorLibProcUPP;
  322.     #define CallBleuRoseErrorLibProc(userRoutine, params)        \
  323.             CallUniversalProc((UniversalProcPtr)(userRoutine), uppBleuRoseErrorLibProcInfo, params)
  324.     #define NewBleuRoseErrorLibProc(userRoutine)                \
  325.             (BleuRoseErrorLibProcUPP)NewRoutineDescriptor ((ProcPtr)(userRoutine), uppBleuRoseErrorLibProcInfo, GetCurrentISA())
  326.     #define NewBleuRoseErrorLibProc68k(userRoutine)                \
  327.             (BleuRoseErrorLibProcUPP)NewRoutineDescriptor ((ProcPtr)(userRoutine), uppBleuRoseErrorLibProcInfo, (ISAType) kM68kISA)
  328. #else
  329.     typedef BleuRoseErrorLib     BleuRoseErrorLibProcUPP;
  330.     #define CallBleuRoseErrorLibProc(userRoutine, params)        \
  331.             (*(userRoutine))(params)
  332.     #define NewBleuRoseErrorLibProc(userRoutine)                \
  333.             (BleuRoseErrorLibProcUPP)(userRoutine)
  334.     #define NewBleuRoseErrorLibProc68k(userRoutine)                \
  335.             (BleuRoseErrorLibProcUPP)(userRoutine)
  336. #endif
  337.  
  338. /******************************************************************
  339.     EPILOGUE
  340.  ******************************************************************/
  341. #if PRAGMA_STRUCT_ALIGN
  342.     #pragma options align=reset
  343. #elif PRAGMA_STRUCT_PACKPUSH
  344.     #pragma pack(pop)
  345. #elif PRAGMA_STRUCT_PACK
  346.     #pragma pack()
  347. #endif
  348.  
  349. #ifdef PRAGMA_IMPORT_OFF
  350.     #pragma import off
  351. #elif PRAGMA_IMPORT
  352.     #pragma import reset
  353. #endif
  354.  
  355. #ifdef __cplusplus
  356. }
  357. #endif
  358.  
  359. #endif /* __BleuRoseErrors__ */